<?php

/**
 * Page form base class.
 *
 * @method Page getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePageForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'page_id'          => new sfWidgetFormInputHidden(),
      'candidate_access' => new sfWidgetFormChoice(array('choices' => array('public' => 'public', 'network' => 'network', 'maildomain' => 'maildomain'))),
      'fan_restricted'   => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'page_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('page_id')), 'empty_value' => $this->getObject()->get('page_id'), 'required' => false)),
      'candidate_access' => new sfValidatorChoice(array('choices' => array(0 => 'public', 1 => 'network', 2 => 'maildomain'), 'required' => false)),
      'fan_restricted'   => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('page[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Page';
  }

}
